aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/pot/[name]/sweep/+page.server.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-05-21 22:00:53 -0700
committerAdam Soltys <[email protected]>2023-05-21 22:00:53 -0700
commitba9f06dfdbde4eb51f1a25a1f68a0e6c8a3c5e2e (patch)
tree6204d8235672452e29c2acf71a9561f7423e153c /src/routes/(app)/pot/[name]/sweep/+page.server.js
parentfcaf3085acc140443c32a616b5f8ee3a7edf8a90 (diff)
downloadcoinos-ui-ba9f06dfdbde4eb51f1a25a1f68a0e6c8a3c5e2e.tar.gz
coinos-ui-ba9f06dfdbde4eb51f1a25a1f68a0e6c8a3c5e2e.zip
pot sweep function
Diffstat (limited to 'src/routes/(app)/pot/[name]/sweep/+page.server.js')
-rw-r--r--src/routes/(app)/pot/[name]/sweep/+page.server.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/routes/(app)/pot/[name]/sweep/+page.server.js b/src/routes/(app)/pot/[name]/sweep/+page.server.js
new file mode 100644
index 00000000..dc6d17c1
--- /dev/null
+++ b/src/routes/(app)/pot/[name]/sweep/+page.server.js
@@ -0,0 +1,13 @@
+import { get, auth, post } from '$lib/utils';
+import { redirect } from '@sveltejs/kit';
+
+export async function load({ cookies, params, parent }) {
+ let { user } = await parent();
+ let { name } = params;
+ let { amount } = await get(`/pot/${name}`);
+
+
+ if (!user) throw redirect(307, `/register?redirect=/pot/${name}/sweep`);
+ // await post('/take', { amount, name }, auth(cookies));
+ return { amount, name };
+}